import {$} from '../js/library/jquery.js';
import '../js/library/header.js';
import  '../js/library/slideshow.js';
import  '../js/library/switch.js';
import  '../js/library/count.js';
import '../js/library/jquery.lazyload.js';
import 'https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js';
import 'https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js';


$.ajax({
  
    type: "get",
    url: "../../interface/index.php",

    dataType: "json",
    success: function (res) {
     
        let temp='';
        res.forEach((elm,i)=>{
            let picture=JSON.parse(elm.picture);
          
            temp+=`<li>
            <a href="./details.html?id=${elm.id}">
              <div class="potot">
                <img class="lazy" data-original="../${picture[0].src}" alt="" />
              </div>
              <h3>小米MIX FOLD</h3>
              <p class="exc">${elm.title}</p>
              <p class="price">
                <span class="num">${elm.price}</span>元
                <span>起</span>
              </p>
            </a>
          </li>`;
        })
        $('.home-span-list').html(temp);
        $("img.lazy").lazyload({effect: "fadeIn"});

    }
});

  $(function(){
 


   

  

        //固定导航栏

        $('.top').click(function(){
            $('.top').attr('href','#');
        })

        
        //图片切换

        $('.row-next').click(function(){
            $('.row-next').css('background','#ccc');
            $('.row-prev').css('background','none');
           $('.row-ul').css({'transform':'translateX(-984px)'});
           $('.row-ul').css({'transition':'1s'});
        });
        $('.row-prev').click(function(){
            $('.row-prev').css('background','#ccc');
            $('.row-next').css('background','none');
            $('.row-ul').css({'transform':'translateX(0px)'});
            $('.row-ul').css({'transition':'1s'});
         });
         


       


         //底部
        setInterval(function(){
            $('.opc').removeClass('opc').siblings().addClass('opc');
           
        },2000);
        

    });

